package com.digitalchina.lxnsy.adapter;

import android.app.Fragment;
import android.app.FragmentManager;
import androidx.legacy.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import com.digitalchina.lxnsy.entity.PagerItemVO;
import com.digitalchina.lxnsy.view.MyTabLayout;

import java.util.List;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：带有TAB切换便签的viewpager
 * 包名：com.digitalchina.bigdata.adapter
 * 创建人：郑皓
 * 创建时间：2016/6/7 15:59
 * 修改备注：
 * ================================================
 */
public class TabViewPagerAdapter extends FragmentPagerAdapter implements MyTabLayout.TabItemName {

    List<PagerItemVO> mList;

    public TabViewPagerAdapter(FragmentManager fm, List<PagerItemVO> plist) {
        super(fm);
        this.mList = plist;
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public String getTabName(int position) {
        return mList.get(position).getTitle();
    }

    @Override
    public int getDrawable(int position) {
        return mList.get(position).getDrawable();
    }

    @Override
    public int getDrawableSelect(int position) {
        return mList.get(position).getDrawableSelect();
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
    }
}